/*
 * Selling Partner API for Notifications
 * The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner's business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more.  For more information, refer to the [Notifications Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide).
 *
 * OpenAPI spec version: v1
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package software.amazon.spapi.api.notifications.v1;

import com.amazon.SellingPartnerAPIAA.LWAAccessTokenCache;
import com.amazon.SellingPartnerAPIAA.LWAAccessTokenCacheImpl;
import com.amazon.SellingPartnerAPIAA.LWAAuthorizationCredentials;
import com.amazon.SellingPartnerAPIAA.LWAAuthorizationSigner;
import com.amazon.SellingPartnerAPIAA.LWAException;
import com.amazon.SellingPartnerAPIAA.RestrictedDataTokenSigner;
import com.google.gson.reflect.TypeToken;
import io.github.bucket4j.Bucket;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import software.amazon.spapi.ApiCallback;
import software.amazon.spapi.ApiClient;
import software.amazon.spapi.ApiException;
import software.amazon.spapi.ApiResponse;
import software.amazon.spapi.Configuration;
import software.amazon.spapi.Pair;
import software.amazon.spapi.ProgressRequestBody;
import software.amazon.spapi.StringUtil;
import software.amazon.spapi.models.notifications.v1.CreateDestinationRequest;
import software.amazon.spapi.models.notifications.v1.CreateDestinationResponse;
import software.amazon.spapi.models.notifications.v1.CreateSubscriptionRequest;
import software.amazon.spapi.models.notifications.v1.CreateSubscriptionResponse;
import software.amazon.spapi.models.notifications.v1.DeleteDestinationResponse;
import software.amazon.spapi.models.notifications.v1.DeleteSubscriptionByIdResponse;
import software.amazon.spapi.models.notifications.v1.GetDestinationResponse;
import software.amazon.spapi.models.notifications.v1.GetDestinationsResponse;
import software.amazon.spapi.models.notifications.v1.GetSubscriptionByIdResponse;
import software.amazon.spapi.models.notifications.v1.GetSubscriptionResponse;

public class NotificationsApi {
    private ApiClient apiClient;
    private Boolean disableRateLimiting;

    public NotificationsApi(ApiClient apiClient, Boolean disableRateLimiting) {
        this.apiClient = apiClient;
        this.disableRateLimiting = disableRateLimiting;
    }

    private final Configuration config = Configuration.get();

    public final Bucket createDestinationBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-createDestination"))
            .build();

    public final Bucket createSubscriptionBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-createSubscription"))
            .build();

    public final Bucket deleteDestinationBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-deleteDestination"))
            .build();

    public final Bucket deleteSubscriptionByIdBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-deleteSubscriptionById"))
            .build();

    public final Bucket getDestinationBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-getDestination"))
            .build();

    public final Bucket getDestinationsBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-getDestinations"))
            .build();

    public final Bucket getSubscriptionBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-getSubscription"))
            .build();

    public final Bucket getSubscriptionByIdBucket = Bucket.builder()
            .addLimit(config.getLimit("NotificationsApi-getSubscriptionById"))
            .build();

    /**
     * Build call for createDestination
     *
     * @param body (required)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call createDestinationCall(
            CreateDestinationRequest body, final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/notifications/v1/destinations";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {"application/json"};
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "POST",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call createDestinationValidateBeforeCall(
            CreateDestinationRequest body, final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling createDestination(Async)");
        }

        return createDestinationCall(body, progressRequestListener);
    }

    /**
     * Creates a destination resource to receive notifications. The &#x60;createDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return CreateDestinationResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public CreateDestinationResponse createDestination(CreateDestinationRequest body, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<CreateDestinationResponse> resp = createDestinationWithHttpInfo(body, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Creates a destination resource to receive notifications. The &#x60;createDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @return CreateDestinationResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public CreateDestinationResponse createDestination(CreateDestinationRequest body)
            throws ApiException, LWAException {
        ApiResponse<CreateDestinationResponse> resp = createDestinationWithHttpInfo(body, null);
        return resp.getData();
    }

    /**
     * Creates a destination resource to receive notifications. The &#x60;createDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;CreateDestinationResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<CreateDestinationResponse> createDestinationWithHttpInfo(
            CreateDestinationRequest body, String restrictedDataToken) throws ApiException, LWAException {
        okhttp3.Call call = createDestinationValidateBeforeCall(body, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request =
                    RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-createDestination");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || createDestinationBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<CreateDestinationResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("createDestination operation exceeds rate limit");
    }

    /**
     * Creates a destination resource to receive notifications. The &#x60;createDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @return ApiResponse&lt;CreateDestinationResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<CreateDestinationResponse> createDestinationWithHttpInfo(CreateDestinationRequest body)
            throws ApiException, LWAException {
        return createDestinationWithHttpInfo(body, null);
    }

    /**
     * (asynchronously) Creates a destination resource to receive notifications. The &#x60;createDestination&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call createDestinationAsync(
            CreateDestinationRequest body, final ApiCallback<CreateDestinationResponse> callback)
            throws ApiException, LWAException {
        return createDestinationAsync(body, callback, null);
    }
    /**
     * (asynchronously) Creates a destination resource to receive notifications. The &#x60;createDestination&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call createDestinationAsync(
            CreateDestinationRequest body,
            final ApiCallback<CreateDestinationResponse> callback,
            String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call = createDestinationValidateBeforeCall(body, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request =
                    RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-createDestination");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || createDestinationBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<CreateDestinationResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("createDestination operation exceeds rate limit");
    }
    /**
     * Build call for createSubscription
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call createSubscriptionCall(
            CreateSubscriptionRequest body,
            String notificationType,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/notifications/v1/subscriptions/{notificationType}"
                .replaceAll("\\{" + "notificationType" + "\\}", apiClient.escapeString(notificationType.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {"application/json"};
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "POST",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call createSubscriptionValidateBeforeCall(
            CreateSubscriptionRequest body,
            String notificationType,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling createSubscription(Async)");
        }
        // verify the required parameter 'notificationType' is set
        if (notificationType == null) {
            throw new ApiException(
                    "Missing the required parameter 'notificationType' when calling createSubscription(Async)");
        }

        return createSubscriptionCall(body, notificationType, progressRequestListener);
    }

    /**
     * Creates a subscription for the specified notification type to be delivered to the specified destination. Before
     * you can subscribe, you must first create the destination by calling the &#x60;createDestination&#x60; operation.
     * In cases where the specified notification type supports multiple payload versions, you can utilize this API to
     * subscribe to a different payload version if you already have an existing subscription for a different payload
     * version. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return CreateSubscriptionResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public CreateSubscriptionResponse createSubscription(
            CreateSubscriptionRequest body, String notificationType, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<CreateSubscriptionResponse> resp =
                createSubscriptionWithHttpInfo(body, notificationType, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Creates a subscription for the specified notification type to be delivered to the specified destination. Before
     * you can subscribe, you must first create the destination by calling the &#x60;createDestination&#x60; operation.
     * In cases where the specified notification type supports multiple payload versions, you can utilize this API to
     * subscribe to a different payload version if you already have an existing subscription for a different payload
     * version. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @return CreateSubscriptionResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public CreateSubscriptionResponse createSubscription(CreateSubscriptionRequest body, String notificationType)
            throws ApiException, LWAException {
        ApiResponse<CreateSubscriptionResponse> resp = createSubscriptionWithHttpInfo(body, notificationType, null);
        return resp.getData();
    }

    /**
     * Creates a subscription for the specified notification type to be delivered to the specified destination. Before
     * you can subscribe, you must first create the destination by calling the &#x60;createDestination&#x60; operation.
     * In cases where the specified notification type supports multiple payload versions, you can utilize this API to
     * subscribe to a different payload version if you already have an existing subscription for a different payload
     * version. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;CreateSubscriptionResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<CreateSubscriptionResponse> createSubscriptionWithHttpInfo(
            CreateSubscriptionRequest body, String notificationType, String restrictedDataToken)
            throws ApiException, LWAException {
        okhttp3.Call call = createSubscriptionValidateBeforeCall(body, notificationType, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request =
                    RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-createSubscription");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || createSubscriptionBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<CreateSubscriptionResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("createSubscription operation exceeds rate limit");
    }

    /**
     * Creates a subscription for the specified notification type to be delivered to the specified destination. Before
     * you can subscribe, you must first create the destination by calling the &#x60;createDestination&#x60; operation.
     * In cases where the specified notification type supports multiple payload versions, you can utilize this API to
     * subscribe to a different payload version if you already have an existing subscription for a different payload
     * version. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @return ApiResponse&lt;CreateSubscriptionResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<CreateSubscriptionResponse> createSubscriptionWithHttpInfo(
            CreateSubscriptionRequest body, String notificationType) throws ApiException, LWAException {
        return createSubscriptionWithHttpInfo(body, notificationType, null);
    }

    /**
     * (asynchronously) Creates a subscription for the specified notification type to be delivered to the specified
     * destination. Before you can subscribe, you must first create the destination by calling the
     * &#x60;createDestination&#x60; operation. In cases where the specified notification type supports multiple payload
     * versions, you can utilize this API to subscribe to a different payload version if you already have an existing
     * subscription for a different payload version. **Usage Plan:** | Rate (requests per second) | Burst | | ---- |
     * ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that
     * were applied to the requested operation, when available. The table above indicates the default rate and burst
     * values for this operation. Selling partners whose business demands require higher throughput may observe higher
     * rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the
     * Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call createSubscriptionAsync(
            CreateSubscriptionRequest body,
            String notificationType,
            final ApiCallback<CreateSubscriptionResponse> callback)
            throws ApiException, LWAException {
        return createSubscriptionAsync(body, notificationType, callback, null);
    }
    /**
     * (asynchronously) Creates a subscription for the specified notification type to be delivered to the specified
     * destination. Before you can subscribe, you must first create the destination by calling the
     * &#x60;createDestination&#x60; operation. In cases where the specified notification type supports multiple payload
     * versions, you can utilize this API to subscribe to a different payload version if you already have an existing
     * subscription for a different payload version. **Usage Plan:** | Rate (requests per second) | Burst | | ---- |
     * ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that
     * were applied to the requested operation, when available. The table above indicates the default rate and burst
     * values for this operation. Selling partners whose business demands require higher throughput may observe higher
     * rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the
     * Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param body (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call createSubscriptionAsync(
            CreateSubscriptionRequest body,
            String notificationType,
            final ApiCallback<CreateSubscriptionResponse> callback,
            String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call = createSubscriptionValidateBeforeCall(body, notificationType, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request =
                    RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-createSubscription");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || createSubscriptionBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<CreateSubscriptionResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("createSubscription operation exceeds rate limit");
    }
    /**
     * Build call for deleteDestination
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call deleteDestinationCall(
            String destinationId, final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/notifications/v1/destinations/{destinationId}"
                .replaceAll("\\{" + "destinationId" + "\\}", apiClient.escapeString(destinationId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {};

        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "DELETE",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call deleteDestinationValidateBeforeCall(
            String destinationId, final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'destinationId' is set
        if (destinationId == null) {
            throw new ApiException(
                    "Missing the required parameter 'destinationId' when calling deleteDestination(Async)");
        }

        return deleteDestinationCall(destinationId, progressRequestListener);
    }

    /**
     * Deletes the destination that you specify. The &#x60;deleteDestination&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return DeleteDestinationResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public DeleteDestinationResponse deleteDestination(String destinationId, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<DeleteDestinationResponse> resp = deleteDestinationWithHttpInfo(destinationId, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Deletes the destination that you specify. The &#x60;deleteDestination&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @return DeleteDestinationResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public DeleteDestinationResponse deleteDestination(String destinationId) throws ApiException, LWAException {
        ApiResponse<DeleteDestinationResponse> resp = deleteDestinationWithHttpInfo(destinationId, null);
        return resp.getData();
    }

    /**
     * Deletes the destination that you specify. The &#x60;deleteDestination&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;DeleteDestinationResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<DeleteDestinationResponse> deleteDestinationWithHttpInfo(
            String destinationId, String restrictedDataToken) throws ApiException, LWAException {
        okhttp3.Call call = deleteDestinationValidateBeforeCall(destinationId, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request =
                    RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-deleteDestination");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || deleteDestinationBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<DeleteDestinationResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("deleteDestination operation exceeds rate limit");
    }

    /**
     * Deletes the destination that you specify. The &#x60;deleteDestination&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @return ApiResponse&lt;DeleteDestinationResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<DeleteDestinationResponse> deleteDestinationWithHttpInfo(String destinationId)
            throws ApiException, LWAException {
        return deleteDestinationWithHttpInfo(destinationId, null);
    }

    /**
     * (asynchronously) Deletes the destination that you specify. The &#x60;deleteDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call deleteDestinationAsync(
            String destinationId, final ApiCallback<DeleteDestinationResponse> callback)
            throws ApiException, LWAException {
        return deleteDestinationAsync(destinationId, callback, null);
    }
    /**
     * (asynchronously) Deletes the destination that you specify. The &#x60;deleteDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier for the destination that you want to delete. (required)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call deleteDestinationAsync(
            String destinationId, final ApiCallback<DeleteDestinationResponse> callback, String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call = deleteDestinationValidateBeforeCall(destinationId, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request =
                    RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-deleteDestination");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || deleteDestinationBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<DeleteDestinationResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("deleteDestination operation exceeds rate limit");
    }
    /**
     * Build call for deleteSubscriptionById
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call deleteSubscriptionByIdCall(
            String subscriptionId,
            String notificationType,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/notifications/v1/subscriptions/{notificationType}/{subscriptionId}"
                .replaceAll("\\{" + "subscriptionId" + "\\}", apiClient.escapeString(subscriptionId.toString()))
                .replaceAll("\\{" + "notificationType" + "\\}", apiClient.escapeString(notificationType.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Operation Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {};

        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "DELETE",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call deleteSubscriptionByIdValidateBeforeCall(
            String subscriptionId,
            String notificationType,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'subscriptionId' is set
        if (subscriptionId == null) {
            throw new ApiException(
                    "Missing the required parameter 'subscriptionId' when calling deleteSubscriptionById(Async)");
        }
        // verify the required parameter 'notificationType' is set
        if (notificationType == null) {
            throw new ApiException(
                    "Missing the required parameter 'notificationType' when calling deleteSubscriptionById(Async)");
        }

        return deleteSubscriptionByIdCall(subscriptionId, notificationType, progressRequestListener);
    }

    /**
     * Deletes the subscription indicated by the subscription identifier and notification type that you specify. The
     * subscription identifier can be for any subscription associated with your application. After you successfully call
     * this operation, notifications will stop being sent for the associated subscription. The
     * &#x60;deleteSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return DeleteSubscriptionByIdResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public DeleteSubscriptionByIdResponse deleteSubscriptionById(
            String subscriptionId, String notificationType, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<DeleteSubscriptionByIdResponse> resp =
                deleteSubscriptionByIdWithHttpInfo(subscriptionId, notificationType, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Deletes the subscription indicated by the subscription identifier and notification type that you specify. The
     * subscription identifier can be for any subscription associated with your application. After you successfully call
     * this operation, notifications will stop being sent for the associated subscription. The
     * &#x60;deleteSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @return DeleteSubscriptionByIdResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public DeleteSubscriptionByIdResponse deleteSubscriptionById(String subscriptionId, String notificationType)
            throws ApiException, LWAException {
        ApiResponse<DeleteSubscriptionByIdResponse> resp =
                deleteSubscriptionByIdWithHttpInfo(subscriptionId, notificationType, null);
        return resp.getData();
    }

    /**
     * Deletes the subscription indicated by the subscription identifier and notification type that you specify. The
     * subscription identifier can be for any subscription associated with your application. After you successfully call
     * this operation, notifications will stop being sent for the associated subscription. The
     * &#x60;deleteSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;DeleteSubscriptionByIdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<DeleteSubscriptionByIdResponse> deleteSubscriptionByIdWithHttpInfo(
            String subscriptionId, String notificationType, String restrictedDataToken)
            throws ApiException, LWAException {
        okhttp3.Call call = deleteSubscriptionByIdValidateBeforeCall(subscriptionId, notificationType, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(
                    request, restrictedDataToken, "NotificationsApi-deleteSubscriptionById");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || deleteSubscriptionByIdBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<DeleteSubscriptionByIdResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("deleteSubscriptionById operation exceeds rate limit");
    }

    /**
     * Deletes the subscription indicated by the subscription identifier and notification type that you specify. The
     * subscription identifier can be for any subscription associated with your application. After you successfully call
     * this operation, notifications will stop being sent for the associated subscription. The
     * &#x60;deleteSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @return ApiResponse&lt;DeleteSubscriptionByIdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<DeleteSubscriptionByIdResponse> deleteSubscriptionByIdWithHttpInfo(
            String subscriptionId, String notificationType) throws ApiException, LWAException {
        return deleteSubscriptionByIdWithHttpInfo(subscriptionId, notificationType, null);
    }

    /**
     * (asynchronously) Deletes the subscription indicated by the subscription identifier and notification type that you
     * specify. The subscription identifier can be for any subscription associated with your application. After you
     * successfully call this operation, notifications will stop being sent for the associated subscription. The
     * &#x60;deleteSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call deleteSubscriptionByIdAsync(
            String subscriptionId, String notificationType, final ApiCallback<DeleteSubscriptionByIdResponse> callback)
            throws ApiException, LWAException {
        return deleteSubscriptionByIdAsync(subscriptionId, notificationType, callback, null);
    }
    /**
     * (asynchronously) Deletes the subscription indicated by the subscription identifier and notification type that you
     * specify. The subscription identifier can be for any subscription associated with your application. After you
     * successfully call this operation, notifications will stop being sent for the associated subscription. The
     * &#x60;deleteSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to delete. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call deleteSubscriptionByIdAsync(
            String subscriptionId,
            String notificationType,
            final ApiCallback<DeleteSubscriptionByIdResponse> callback,
            String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call =
                deleteSubscriptionByIdValidateBeforeCall(subscriptionId, notificationType, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(
                    request, restrictedDataToken, "NotificationsApi-deleteSubscriptionById");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || deleteSubscriptionByIdBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<DeleteSubscriptionByIdResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("deleteSubscriptionById operation exceeds rate limit");
    }
    /**
     * Build call for getDestination
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call getDestinationCall(
            String destinationId, final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/notifications/v1/destinations/{destinationId}"
                .replaceAll("\\{" + "destinationId" + "\\}", apiClient.escapeString(destinationId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {};

        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "GET",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call getDestinationValidateBeforeCall(
            String destinationId, final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'destinationId' is set
        if (destinationId == null) {
            throw new ApiException("Missing the required parameter 'destinationId' when calling getDestination(Async)");
        }

        return getDestinationCall(destinationId, progressRequestListener);
    }

    /**
     * Returns information about the destination that you specify. The &#x60;getDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return GetDestinationResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetDestinationResponse getDestination(String destinationId, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<GetDestinationResponse> resp = getDestinationWithHttpInfo(destinationId, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Returns information about the destination that you specify. The &#x60;getDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @return GetDestinationResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetDestinationResponse getDestination(String destinationId) throws ApiException, LWAException {
        ApiResponse<GetDestinationResponse> resp = getDestinationWithHttpInfo(destinationId, null);
        return resp.getData();
    }

    /**
     * Returns information about the destination that you specify. The &#x60;getDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;GetDestinationResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetDestinationResponse> getDestinationWithHttpInfo(
            String destinationId, String restrictedDataToken) throws ApiException, LWAException {
        okhttp3.Call call = getDestinationValidateBeforeCall(destinationId, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-getDestination");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getDestinationBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetDestinationResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("getDestination operation exceeds rate limit");
    }

    /**
     * Returns information about the destination that you specify. The &#x60;getDestination&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @return ApiResponse&lt;GetDestinationResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetDestinationResponse> getDestinationWithHttpInfo(String destinationId)
            throws ApiException, LWAException {
        return getDestinationWithHttpInfo(destinationId, null);
    }

    /**
     * (asynchronously) Returns information about the destination that you specify. The &#x60;getDestination&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getDestinationAsync(String destinationId, final ApiCallback<GetDestinationResponse> callback)
            throws ApiException, LWAException {
        return getDestinationAsync(destinationId, callback, null);
    }
    /**
     * (asynchronously) Returns information about the destination that you specify. The &#x60;getDestination&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param destinationId The identifier generated when you created the destination. (required)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getDestinationAsync(
            String destinationId, final ApiCallback<GetDestinationResponse> callback, String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call = getDestinationValidateBeforeCall(destinationId, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-getDestination");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getDestinationBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetDestinationResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("getDestination operation exceeds rate limit");
    }
    /**
     * Build call for getDestinations
     *
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call getDestinationsCall(final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/notifications/v1/destinations";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {};

        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "GET",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call getDestinationsValidateBeforeCall(
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {

        return getDestinationsCall(progressRequestListener);
    }

    /**
     * Returns information about all destinations. The &#x60;getDestinations&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return GetDestinationsResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetDestinationsResponse getDestinations(String restrictedDataToken) throws ApiException, LWAException {
        ApiResponse<GetDestinationsResponse> resp = getDestinationsWithHttpInfo(restrictedDataToken);
        return resp.getData();
    }

    /**
     * Returns information about all destinations. The &#x60;getDestinations&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @return GetDestinationsResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetDestinationsResponse getDestinations() throws ApiException, LWAException {
        ApiResponse<GetDestinationsResponse> resp = getDestinationsWithHttpInfo(null);
        return resp.getData();
    }

    /**
     * Returns information about all destinations. The &#x60;getDestinations&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;GetDestinationsResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetDestinationsResponse> getDestinationsWithHttpInfo(String restrictedDataToken)
            throws ApiException, LWAException {
        okhttp3.Call call = getDestinationsValidateBeforeCall(null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-getDestinations");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getDestinationsBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetDestinationsResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("getDestinations operation exceeds rate limit");
    }

    /**
     * Returns information about all destinations. The &#x60;getDestinations&#x60; operation is grantless. For more
     * information, refer to [Grantless operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations).
     * **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | The
     * &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the
     * requested operation, when available. The table above indicates the default rate and burst values for this
     * operation. Selling partners whose business demands require higher throughput may observe higher rate and burst
     * values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @return ApiResponse&lt;GetDestinationsResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetDestinationsResponse> getDestinationsWithHttpInfo() throws ApiException, LWAException {
        return getDestinationsWithHttpInfo(null);
    }

    /**
     * (asynchronously) Returns information about all destinations. The &#x60;getDestinations&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getDestinationsAsync(final ApiCallback<GetDestinationsResponse> callback)
            throws ApiException, LWAException {
        return getDestinationsAsync(callback, null);
    }
    /**
     * (asynchronously) Returns information about all destinations. The &#x60;getDestinations&#x60; operation is
     * grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getDestinationsAsync(
            final ApiCallback<GetDestinationsResponse> callback, String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call = getDestinationsValidateBeforeCall(progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-getDestinations");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getDestinationsBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetDestinationsResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("getDestinations operation exceeds rate limit");
    }
    /**
     * Build call for getSubscription
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call getSubscriptionCall(
            String notificationType,
            String payloadVersion,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/notifications/v1/subscriptions/{notificationType}"
                .replaceAll("\\{" + "notificationType" + "\\}", apiClient.escapeString(notificationType.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (payloadVersion != null)
            localVarQueryParams.addAll(apiClient.parameterToPair("payloadVersion", payloadVersion));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {};

        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "GET",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call getSubscriptionValidateBeforeCall(
            String notificationType,
            String payloadVersion,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'notificationType' is set
        if (notificationType == null) {
            throw new ApiException(
                    "Missing the required parameter 'notificationType' when calling getSubscription(Async)");
        }

        return getSubscriptionCall(notificationType, payloadVersion, progressRequestListener);
    }

    /**
     * Returns information about subscription of the specified notification type and payload version.
     * &#x60;payloadVersion&#x60; is an optional parameter. When &#x60;payloadVersion&#x60; is not provided, it will
     * return latest payload version subscription&#x27;s information. You can use this API to get subscription
     * information when you do not have a subscription identifier. **Usage Plan:** | Rate (requests per second) | Burst
     * | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate
     * limits that were applied to the requested operation, when available. The table above indicates the default rate
     * and burst values for this operation. Selling partners whose business demands require higher throughput may
     * observe higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate
     * Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return GetSubscriptionResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetSubscriptionResponse getSubscription(
            String notificationType, String payloadVersion, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<GetSubscriptionResponse> resp =
                getSubscriptionWithHttpInfo(notificationType, payloadVersion, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Returns information about subscription of the specified notification type and payload version.
     * &#x60;payloadVersion&#x60; is an optional parameter. When &#x60;payloadVersion&#x60; is not provided, it will
     * return latest payload version subscription&#x27;s information. You can use this API to get subscription
     * information when you do not have a subscription identifier. **Usage Plan:** | Rate (requests per second) | Burst
     * | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate
     * limits that were applied to the requested operation, when available. The table above indicates the default rate
     * and burst values for this operation. Selling partners whose business demands require higher throughput may
     * observe higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate
     * Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @return GetSubscriptionResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetSubscriptionResponse getSubscription(String notificationType, String payloadVersion)
            throws ApiException, LWAException {
        ApiResponse<GetSubscriptionResponse> resp = getSubscriptionWithHttpInfo(notificationType, payloadVersion, null);
        return resp.getData();
    }

    /**
     * Returns information about subscription of the specified notification type and payload version.
     * &#x60;payloadVersion&#x60; is an optional parameter. When &#x60;payloadVersion&#x60; is not provided, it will
     * return latest payload version subscription&#x27;s information. You can use this API to get subscription
     * information when you do not have a subscription identifier. **Usage Plan:** | Rate (requests per second) | Burst
     * | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate
     * limits that were applied to the requested operation, when available. The table above indicates the default rate
     * and burst values for this operation. Selling partners whose business demands require higher throughput may
     * observe higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate
     * Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;GetSubscriptionResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetSubscriptionResponse> getSubscriptionWithHttpInfo(
            String notificationType, String payloadVersion, String restrictedDataToken)
            throws ApiException, LWAException {
        okhttp3.Call call = getSubscriptionValidateBeforeCall(notificationType, payloadVersion, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-getSubscription");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getSubscriptionBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetSubscriptionResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("getSubscription operation exceeds rate limit");
    }

    /**
     * Returns information about subscription of the specified notification type and payload version.
     * &#x60;payloadVersion&#x60; is an optional parameter. When &#x60;payloadVersion&#x60; is not provided, it will
     * return latest payload version subscription&#x27;s information. You can use this API to get subscription
     * information when you do not have a subscription identifier. **Usage Plan:** | Rate (requests per second) | Burst
     * | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate
     * limits that were applied to the requested operation, when available. The table above indicates the default rate
     * and burst values for this operation. Selling partners whose business demands require higher throughput may
     * observe higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate
     * Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @return ApiResponse&lt;GetSubscriptionResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetSubscriptionResponse> getSubscriptionWithHttpInfo(
            String notificationType, String payloadVersion) throws ApiException, LWAException {
        return getSubscriptionWithHttpInfo(notificationType, payloadVersion, null);
    }

    /**
     * (asynchronously) Returns information about subscription of the specified notification type and payload version.
     * &#x60;payloadVersion&#x60; is an optional parameter. When &#x60;payloadVersion&#x60; is not provided, it will
     * return latest payload version subscription&#x27;s information. You can use this API to get subscription
     * information when you do not have a subscription identifier. **Usage Plan:** | Rate (requests per second) | Burst
     * | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate
     * limits that were applied to the requested operation, when available. The table above indicates the default rate
     * and burst values for this operation. Selling partners whose business demands require higher throughput may
     * observe higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate
     * Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getSubscriptionAsync(
            String notificationType, String payloadVersion, final ApiCallback<GetSubscriptionResponse> callback)
            throws ApiException, LWAException {
        return getSubscriptionAsync(notificationType, payloadVersion, callback, null);
    }
    /**
     * (asynchronously) Returns information about subscription of the specified notification type and payload version.
     * &#x60;payloadVersion&#x60; is an optional parameter. When &#x60;payloadVersion&#x60; is not provided, it will
     * return latest payload version subscription&#x27;s information. You can use this API to get subscription
     * information when you do not have a subscription identifier. **Usage Plan:** | Rate (requests per second) | Burst
     * | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate
     * limits that were applied to the requested operation, when available. The table above indicates the default rate
     * and burst values for this operation. Selling partners whose business demands require higher throughput may
     * observe higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate
     * Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param payloadVersion The version of the payload object to be used in the notification. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getSubscriptionAsync(
            String notificationType,
            String payloadVersion,
            final ApiCallback<GetSubscriptionResponse> callback,
            String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call =
                getSubscriptionValidateBeforeCall(notificationType, payloadVersion, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(request, restrictedDataToken, "NotificationsApi-getSubscription");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getSubscriptionBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetSubscriptionResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("getSubscription operation exceeds rate limit");
    }
    /**
     * Build call for getSubscriptionById
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    private okhttp3.Call getSubscriptionByIdCall(
            String subscriptionId,
            String notificationType,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/notifications/v1/subscriptions/{notificationType}/{subscriptionId}"
                .replaceAll("\\{" + "subscriptionId" + "\\}", apiClient.escapeString(subscriptionId.toString()))
                .replaceAll("\\{" + "notificationType" + "\\}", apiClient.escapeString(notificationType.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {"application/json", "Successful Response"};
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {};

        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        return apiClient.buildCall(
                localVarPath,
                "GET",
                localVarQueryParams,
                localVarCollectionQueryParams,
                localVarPostBody,
                localVarHeaderParams,
                localVarFormParams,
                progressRequestListener);
    }

    private okhttp3.Call getSubscriptionByIdValidateBeforeCall(
            String subscriptionId,
            String notificationType,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener)
            throws ApiException, LWAException {
        // verify the required parameter 'subscriptionId' is set
        if (subscriptionId == null) {
            throw new ApiException(
                    "Missing the required parameter 'subscriptionId' when calling getSubscriptionById(Async)");
        }
        // verify the required parameter 'notificationType' is set
        if (notificationType == null) {
            throw new ApiException(
                    "Missing the required parameter 'notificationType' when calling getSubscriptionById(Async)");
        }

        return getSubscriptionByIdCall(subscriptionId, notificationType, progressRequestListener);
    }

    /**
     * Returns information about a subscription for the specified notification type. The &#x60;getSubscriptionById&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return GetSubscriptionByIdResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetSubscriptionByIdResponse getSubscriptionById(
            String subscriptionId, String notificationType, String restrictedDataToken)
            throws ApiException, LWAException {
        ApiResponse<GetSubscriptionByIdResponse> resp =
                getSubscriptionByIdWithHttpInfo(subscriptionId, notificationType, restrictedDataToken);
        return resp.getData();
    }

    /**
     * Returns information about a subscription for the specified notification type. The &#x60;getSubscriptionById&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @return GetSubscriptionByIdResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public GetSubscriptionByIdResponse getSubscriptionById(String subscriptionId, String notificationType)
            throws ApiException, LWAException {
        ApiResponse<GetSubscriptionByIdResponse> resp =
                getSubscriptionByIdWithHttpInfo(subscriptionId, notificationType, null);
        return resp.getData();
    }

    /**
     * Returns information about a subscription for the specified notification type. The &#x60;getSubscriptionById&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return ApiResponse&lt;GetSubscriptionByIdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetSubscriptionByIdResponse> getSubscriptionByIdWithHttpInfo(
            String subscriptionId, String notificationType, String restrictedDataToken)
            throws ApiException, LWAException {
        okhttp3.Call call = getSubscriptionByIdValidateBeforeCall(subscriptionId, notificationType, null);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(
                    request, restrictedDataToken, "NotificationsApi-getSubscriptionById");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getSubscriptionByIdBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetSubscriptionByIdResponse>() {}.getType();
            return apiClient.execute(call, localVarReturnType);
        } else throw new ApiException.RateLimitExceeded("getSubscriptionById operation exceeds rate limit");
    }

    /**
     * Returns information about a subscription for the specified notification type. The &#x60;getSubscriptionById&#x60;
     * operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @return ApiResponse&lt;GetSubscriptionByIdResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public ApiResponse<GetSubscriptionByIdResponse> getSubscriptionByIdWithHttpInfo(
            String subscriptionId, String notificationType) throws ApiException, LWAException {
        return getSubscriptionByIdWithHttpInfo(subscriptionId, notificationType, null);
    }

    /**
     * (asynchronously) Returns information about a subscription for the specified notification type. The
     * &#x60;getSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getSubscriptionByIdAsync(
            String subscriptionId, String notificationType, final ApiCallback<GetSubscriptionByIdResponse> callback)
            throws ApiException, LWAException {
        return getSubscriptionByIdAsync(subscriptionId, notificationType, callback, null);
    }
    /**
     * (asynchronously) Returns information about a subscription for the specified notification type. The
     * &#x60;getSubscriptionById&#x60; operation is grantless. For more information, refer to [Grantless
     * operations](https://developer-docs.amazon.com/sp-api/docs/grantless-operations). **Usage Plan:** | Rate (requests
     * per second) | Burst | | ---- | ---- | | 1 | 5 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns
     * the usage plan rate limits that were applied to the requested operation, when available. The table above
     * indicates the default rate and burst values for this operation. Selling partners whose business demands require
     * higher throughput may observe higher rate and burst values than those shown here. For more information, refer to
     * [Usage Plans and Rate Limits in the Selling Partner
     * API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
     *
     * @param subscriptionId The identifier for the subscription that you want to get. (required)
     * @param notificationType The type of notification. For more information about notification types, refer to
     *     [Notification Type Values](https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
     *     (required)
     * @param callback The callback to be executed when the API call finishes
     * @param restrictedDataToken Restricted Data Token (optional)
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @throws LWAException If calls to fetch LWA access token fails
     */
    public okhttp3.Call getSubscriptionByIdAsync(
            String subscriptionId,
            String notificationType,
            final ApiCallback<GetSubscriptionByIdResponse> callback,
            String restrictedDataToken)
            throws ApiException, LWAException {

        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressRequestListener = callback::onUploadProgress;
        }

        okhttp3.Call call =
                getSubscriptionByIdValidateBeforeCall(subscriptionId, notificationType, progressRequestListener);

        if (restrictedDataToken != null) {
            okhttp3.Request request = call.request();
            request = RestrictedDataTokenSigner.sign(
                    request, restrictedDataToken, "NotificationsApi-getSubscriptionById");
            call = apiClient.getHttpClient().newCall(request);
        }

        if (disableRateLimiting || getSubscriptionByIdBucket.tryConsume(1)) {
            Type localVarReturnType = new TypeToken<GetSubscriptionByIdResponse>() {}.getType();
            apiClient.executeAsync(call, localVarReturnType, callback);
            return call;
        } else throw new ApiException.RateLimitExceeded("getSubscriptionById operation exceeds rate limit");
    }

    public static class Builder {
        private LWAAuthorizationCredentials lwaAuthorizationCredentials;
        private String endpoint;
        private LWAAccessTokenCache lwaAccessTokenCache;
        private Boolean disableAccessTokenCache = false;
        private Boolean disableRateLimiting = false;

        public Builder lwaAuthorizationCredentials(LWAAuthorizationCredentials lwaAuthorizationCredentials) {
            this.lwaAuthorizationCredentials = lwaAuthorizationCredentials;
            return this;
        }

        public Builder endpoint(String endpoint) {
            this.endpoint = endpoint;
            return this;
        }

        public Builder lwaAccessTokenCache(LWAAccessTokenCache lwaAccessTokenCache) {
            this.lwaAccessTokenCache = lwaAccessTokenCache;
            return this;
        }

        public Builder disableAccessTokenCache() {
            this.disableAccessTokenCache = true;
            return this;
        }

        public Builder disableRateLimiting() {
            this.disableRateLimiting = true;
            return this;
        }

        public NotificationsApi build() {
            if (lwaAuthorizationCredentials == null) {
                throw new RuntimeException("LWAAuthorizationCredentials not set");
            }

            if (StringUtil.isEmpty(endpoint)) {
                throw new RuntimeException("Endpoint not set");
            }

            LWAAuthorizationSigner lwaAuthorizationSigner = null;
            if (disableAccessTokenCache) {
                lwaAuthorizationSigner = new LWAAuthorizationSigner(lwaAuthorizationCredentials);
            } else {
                if (lwaAccessTokenCache == null) {
                    lwaAccessTokenCache = new LWAAccessTokenCacheImpl();
                }
                lwaAuthorizationSigner = new LWAAuthorizationSigner(lwaAuthorizationCredentials, lwaAccessTokenCache);
            }

            return new NotificationsApi(
                    new ApiClient()
                            .setLWAAuthorizationSigner(lwaAuthorizationSigner)
                            .setBasePath(endpoint),
                    disableRateLimiting);
        }
    }
}
